package sort;

import java.util.Arrays;
import java.util.Random;

public class TestSort {
    public static void main(String[] args) {
        int[] arr = new int[10_0000];
        orderArray2(arr);
//        testQuickSort(arr);
        testQuickSortOptimize(arr);
    }
    public static void orderArray(int[] arr){
        Random random = new Random();
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(10000);
        }
    }
    public static void orderArray2(int[] arr){
        Random random = new Random();
        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;
        }
    }
    public static void testQuickSort(int[] arr){
        arr = Arrays.copyOf(arr,arr.length);
        long startTime = System.currentTimeMillis();
        QuickSort.quickSort(arr);
        long endTime = System.currentTimeMillis();
        System.out.println(endTime - startTime);
    }
    public static void testQuickSortOptimize(int[] arr){
        arr = Arrays.copyOf(arr,arr.length);
        long startTime = System.currentTimeMillis();
        QuickSotrOptimize.quickSorthreeNum(arr);
        long endTime = System.currentTimeMillis();
        System.out.println(endTime - startTime);
    }
}
